package com.x.mvp.appbar;

import android.support.v7.widget.Toolbar;
import android.widget.LinearLayout;

import com.x.mvp.R;
import com.x.mvp.base.view.fragment.FragmentView;


public class TransAppBarFragment extends FragmentView<AppBarPresenter> {
    protected Toolbar toolbar;
    protected LinearLayout centerSpace;
    protected LinearLayout rightSpace;
    protected LinearLayout leftSpace;

    AppBarBuilder appBarBuilder;

    public void setAppBarBuilder(AppBarBuilder appBarBuilder) {
        this.appBarBuilder = appBarBuilder;
    }

    @Override
    protected void injectComponent() {
        getFragmentComponent().inject(this);
    }

    @Override
    protected int getLayoutId() {
        return R.layout.toolbar_appbar;
    }

    @Override
    protected void initView() {
        leftSpace = mainView.findViewById(R.id.left_space);
        rightSpace = mainView.findViewById(R.id.right_space);
        centerSpace = mainView.findViewById(R.id.center_space);
        toolbar = mainView.findViewById(R.id.toolbar_actionbar);
        if (appBarBuilder != null) {
            appBarBuilder.initView(toolbar, centerSpace, rightSpace, leftSpace);
        }
    }
}
